package com.crm.crm.util;

import com.crm.crm.domain.ThreadEntity;

/**
 * @Description TODO
 * @Author bo.li
 * @Date 2025/5/23 19:37
 * @Version 1.0
 */
public class UserThreadLocalUtil {
    public static ThreadLocal<ThreadEntity> threadLocal = new ThreadLocal<>();
    public static void setCurrent(ThreadEntity user){
        threadLocal.set(user);
    }

    public static Long getCurrentUserId() {
        return threadLocal.get().getId();
    }

    public static String getCurrentUserName(){
        return threadLocal.get().getName();
    }

    public static void removeCurrentUser() {
        threadLocal.remove();
    }
}